<template>
	<view>
		
		<view class="select-view" style="border: #318df1 solid 4rpx;" @click="scan">
			<text>扫码出库</text>
			<image src="/static/scan.png" mode="aspectFit"></image>
		</view>
		
		<view class="select-view" style="border: #fe9a03 solid 4rpx;" @click="input">
			<text>录入出库</text>
			<image src="/static/input.png" mode="aspectFit"></image>
		</view>
		
	</view>
</template>
<style lang="scss">
	page{
		background-color: #FFFFFF;
	}
	.select-view{
		display: flex;
		flex-direction: row;
		background-color: #FFFFFF;
		justify-content: space-between;
		align-items: center;
		height: 352rpx;
		width: 700rpx;
		margin: 0 auto;
		margin-top: 70rpx;
		box-sizing: border-box;
		padding: 100rpx;
		border-radius: 20rpx;
		text{
			font-size: 34rpx;
			font-weight: bold;
		}
		image{
			width: 100rpx;
			height: 100rpx;
		}
	}
</style>
<script>
	export default {
		data() {
			return {
				
			}
		},
		onLoad(){
			
		},
		methods: {
			scan(){
				uni.scanCode({
					onlyFromCamera:true,
					scanType:"barCode",
					success:res => {
						console.log(123);
						console.log(res.result);
						if(res.errMsg == "scanCode:ok" && res.result){
							this.$u.http.get("mall/goods/get",{sn:res.result}).then(res => {
								if(res.code){
									uni.navigateTo({
										url:"/pages/mall/info?id="+res.data
									})
								}else{
									this.$u.toast(res.msg);
								}
							})
						}else{
							this.$u.toast("扫码失败");
						}
					},
					fail(){
						this.$u.toast("扫码失败");
					},
					complete(res){
						console.log(res);
					}
				})
			},
			input(){
				uni.navigateTo({
					url:"/pages/mall/next"
				})
			}
		}
	}
</script>

<style>

</style>
